PATHMac OS 8 and 9 Developer Documentation > Interapplication Communication > AppleScript for Scripters >

AppleScript Language Guide

   

Handlers

Handlers are collections of statements that are executed in response to commands or error messages. Table A-10 summarizes handler definitions and subroutine calls. Handlers are described in detail in Handlers.

Table A-10   Handler definitions and calls  

Handler

Syntax

Subroutine definition (labeled parameters) ( on | to ) subroutineName ¬
[ of | in directParameterVariable ] ¬
[ subroutineParamLabel paramVariable ] ... ¬
[ given label : paramVariable [, label: paramVariable ]...]
[ global variable [, variable ]...]
[ local variable [, variable ]...]
[ statement ]...
end [ subroutineName ]
Subroutine call (labeled parameters) subroutineName ¬
[ ( of | in ) directParameter ] ¬
[ subroutineParamLabel parameterValue ] ¬
| [ with labelForTrueParam [, labelForTrueParam ]... ¬
[( and | or | , ) labelForTrueParam ] ] ¬
| [ without labelForFalseParam [, labelForFalseParam ]... ¬
[( and | or | , ) labelForFalseParam ] ] ¬
| [ given label : parameterValue ¬
[, label : parameterValue ]...]...
Subroutine definition (positional parameters) ( on | to ) subroutineName ( [ paramVariable [, paramVariable ]...] )
[ global variable [, variable ]...]
[ local variable [, variable ]...]
[ statement ]...
end [ subroutineName ]
Subroutine call (positional parameters) subroutineName ( [ parameterValue [, parameterValue ]...] )
Return statement return expression
Command handler definition ( on | to ) commandName ¬
[ [ of ] directParameterVariable ] ¬
[ [ given ] label : paramVariable [, label : paramVariable ]...]
[ global variable [, variable ]...]
[ local variable [, variable ]...]
[ statement ]...
end [ commandName ]

© 1999 Apple Computer, Inc. – (Last Updated 21 May 99)